fix(minting-service): bundle Vercel functions via Nx esbuild build#133
Merged
Conversation
The prior `tsc --noEmit` buildCommand didn't emit any JS, so Vercel would still try to compile `api/*.ts` directly at deploy time. That path can't resolve `@cacheplane/db` or `@cacheplane/licensing` because `libs/*` isn't in the root npm workspaces and the libs don't declare `exports` entry points. Switch to Nx-native build: a new `build` target runs esbuild over every `api/*.ts`, inlining workspace deps via tsconfig paths and emitting Vercel Build Output API v3 layout under `.vercel/output/`. Each `.func` colocates a `package.json` pinning `commonjs` to override the app's `"type": "module"`. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3 tasks
blove
added a commit
that referenced
this pull request
Apr 21, 2026
…loy (#134) The Nx esbuild build (PR #133) produced a correct Build Output API v3 layout under `.vercel/output/functions/api/*.func/`, but Vercel's default Node builder still auto-detects `api/*.ts` at the project root and runs `@vercel/node` on top of our output. That failed with `api/health.ts: Emit skipped` because @vercel/node's tsc doesn't resolve the workspace tsconfig paths. Rename `apps/minting-service/api/` → `apps/minting-service/handlers/` so Vercel's auto-detection finds nothing and falls back to the Build Output API our buildCommand already produces. The deployed URL path (`/api/health`, `/api/stripe-webhook`) is unchanged — esbuild still emits to `.vercel/output/functions/api/<name>.func/`. Co-authored-by: Claude Opus 4 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buildtarget forminting-servicethat bundles eachapi/*.tswith esbuild and emits Vercel Build Output API v3 layout under.vercel/output/.@cacheplane/db,@cacheplane/licensing) are inlined via tsconfig paths — no changes toworkspacesor libs'package.jsonentry points required.tsc --noEmitbuildCommand, which only type-checked and left Vercel to compile TS at deploy time (where@cacheplane/*wouldn't resolve).Why this approach
@nx/esbuildisn't installed in this repo; usingnx:run-commandswith a smallscripts/build.mjskeeps the dep surface minimal (esbuildis already transitively available).api/*.tsscan, so the TS sources stay as source-only and the built.jsfunctions live in.vercel/output/(gitignored)..func/directory ships a colocatedpackage.jsonwith"type": "commonjs"to override the app's"type": "module"— otherwise Node loads the CJS bundle as ESM and silently yields an empty module.Test plan
npx nx build minting-serviceproduces.vercel/output/functions/api/{health,stripe-webhook}.func/index.js+ valid.vc-config.jsonrequire()-loading each bundle yields the expecteddefaulthandler function (andconfig.api.bodyParser: falseon the webhook)npx nx test minting-service— all tests pass/api/healthreturns{ok:true}in production🤖 Generated with Claude Code